//存放素材相关的接口
//引入请求库
import request from '@/utils/request'

//封装请求素材的接口
export const getImages = function (params) {
    //返回一个promise对象
    return request({
        url: '/mp/v1_0/user/images',
        method: 'GET',
        params
    })
}

// 取消收藏/收藏图片接口
export const switchCollect = function (id, collect) {
    //返回一个promise对象
    return request({
        url: `/mp/v1_0/user/images/${id}`,
        method: 'PUT',
        data: {
            collect
        }
    })
}

//删除图片接口
export const delImage = function (id) {
    //返回一个promise对象
    return request({
        url: `/mp/v1_0/user/images/${id}`,
        method: 'DELETE'

    })
}

//上传图片素材接口
export const uploadImage = function (image) {
    //返回一个promise对象
    return request({
        url: '/mp/v1_0/user/images',
        method: 'POST',
        data: {
            image
        }

    })
}